package tomsung.cloud.agdc.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import tomsung.cloud.agdc.bean.User;
import tomsung.cloud.agdc.dao.UserMapper;



@Service("UserService")
public class UserService {

	@Autowired
	UserMapper userMapper;
	
	public User login(String userName) {
		return userMapper.selectByNameAndPw(userName);
	}
	
	public int changePasswd(User user) {
		return userMapper.updateByPrimaryKeySelective(user);
	}

	public int register(User user) {
		
		return userMapper.insertSelective(user);
	}
	
	public int deleteUser(Integer userId)
	{
		return userMapper.deleteByPrimaryKey(userId);
	}
	
	public List<User> getAllUser()
	{
		return userMapper.getAllUser();
	}

	public int updateUser(User record)
	{
		return userMapper.updateByPrimaryKeySelective(record);
	}
}
